//
//  UIView+Category.h
//  TestButton
//
//  Created by LQiyue on 16/4/28.
//  Copyright © 2016年 LQiyue. All rights reserved.
//

#import <UIKit/UIKit.h>
#import<QuartzCore/QuartzCore.h>
#import "UIBadgeView.h"
//#import "UIView+Frame.h"



@class LoadingView, LoadBlankPageView;

typedef NS_ENUM(NSInteger, LoadBlankPageType)
{
    LoadBlankPageType_View = 0,
    LoadBlankPageType_LoadFailed,
    LoadBlankPageType_LoadEmptyData,
    LoadBlankPageType_LoadNoNetwork,
    LoadBlankPageType_LoadNoUnread,
    LoadBlankPageType_LoadNoFollow,
    LoadBlankPageType_LoadAlbumEmptyData,
};

typedef NS_ENUM(NSInteger, BadgePositionType) {
    
    BadgePositionTypeDefault = 0,
    BadgePositionTypeMiddle
};

@interface UIView (Category)

@property (nonatomic, assign) CGFloat width;
@property (nonatomic, assign) CGFloat height;
@property (nonatomic, assign) CGFloat centerX;
@property (nonatomic, assign) CGFloat centerY;

- (void)setTwoTopCorner;
- (void)setTwoTopCorner:(CGFloat)radius;
/// 设置底部两个圆角
- (void)setTwoBottomCorner:(CGFloat)radius;
- (void)setTwoLeftCorner;
- (void)setTwoRightCorner;
- (void)setOneCorner:(UIRectCorner)corner radius:(CGFloat)radius;
- (void)setTopLeftBottomRightCorner:(CGFloat)radius;
- (void)doCircleFrame;
- (void)doNotCircleFrame;
- (void)setCornerRadius:(CGFloat)radius;
- (void)doBorderWidth:(CGFloat)width color:(UIColor *)color cornerRadius:(CGFloat)cornerRadius;

- (UIViewController *)findViewController;
- (void)addBadgeTip:(NSString *)badgeValue withCenterPosition:(CGPoint)center;
- (void)addBadgeTip:(NSString *)badgeValue;
- (void)addBadgePoint:(NSInteger)pointRadius withPosition:(BadgePositionType)type;
- (void)addBadgePoint:(NSInteger)pointRadius withPointPosition:(CGPoint)point;
- (void)removeBadgePoint;
- (void)removeBadgeTips;
- (void)setY:(CGFloat)y;
- (void)setX:(CGFloat)x;
- (void)setOrigin:(CGPoint)origin;
- (void)setHeight:(CGFloat)height;
- (void)setWidth:(CGFloat)width;
- (void)setSize:(CGSize)size;
- (void)setCenterY:(CGFloat)centerY;
- (void)setCenterX:(CGFloat)centerX;

- (CGFloat)maxXOfFrame;

- (void)setSubScrollsToTop:(BOOL)scrollsToTop;

- (void)colorGradientFrom:(UIColor*)color0 toColor:(UIColor*)color1 startP:(CGPoint)point0 EndP:(CGPoint)point1;
- (void)addGradientLayerWithColors:(NSArray *)cgColorArray;
- (void)addGradientLayerWithColors:(NSArray *)cgColorArray locations:(NSArray *)floatNumArray startPoint:(CGPoint )aPoint endPoint:(CGPoint)endPoint;
// iOS 设置渐变色圆角边框
- (void)addGradientLayerWithCornerRadius:(float)cornerRadius withLineWidth:(float)lineWidth withColors:(NSArray *)colors startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint;
- (void)addLineUp:(BOOL)hasUp andDown:(BOOL)hasDown;
- (void)addLineUp:(BOOL)hasUp andDown:(BOOL)hasDown andColor:(UIColor *)color;
- (void)addLineUp:(BOOL)hasUp andDown:(BOOL)hasDown andColor:(UIColor *)color andLeftSpace:(CGFloat)leftSpace;

- (void)addRoundingCorners:(UIRectCorner)corners cornerRadii:(CGSize)cornerRadii;

- (void)removeViewWithTag:(NSInteger)tag;
- (CGSize)doubleSizeOfFrame;
- (void)outputSubviewTree;//输出子视图的目录树

+ (CGRect)frameWithOutNav;
+ (UIViewAnimationOptions)animationOptionsForCurve:(UIViewAnimationCurve)curve;
+ (UIView *)lineViewWithPointYY:(CGFloat)pointY;
+ (UIView *)lineViewWithPointYY:(CGFloat)pointY andColor:(UIColor *)color;
+ (UIView *)lineViewWithPointYY:(CGFloat)pointY andColor:(UIColor *)color andLeftSpace:(CGFloat)leftSpace;
+ (void)outputTreeInView:(UIView *)view withSeparatorCount:(NSInteger)count;//输出某个View的subview目录

#pragma mark - LoadingView
@property (strong, nonatomic) LoadingView *loadingView;
- (void)atViewCenter;
- (void)beginLoading;
- (void)endLoading;
- (BOOL)isLoadAnimating;
- (void)centerLoading;
- (void)showLoadingWithTop:(CGFloat)top;

#pragma mark - BlankPageView
@property (strong, nonatomic) LoadBlankPageView *blankPageView;
- (void)configBlankPage:(LoadBlankPageType)blankPageType hasData:(BOOL)hasData hasError:(BOOL)hasError reloadButtonBlock:(void(^)(id sender))block;

@end



@interface LoadingView : UIView

@property (nonatomic, strong) UIImageView *loopView, *loadImageView; // 闲置UseLoopView

@property (nonatomic, strong) UILabel *loadingLabel;
//@property (nonatomic, strong) UICustomAIView *activityIndicator;
@property (nonatomic, strong) UIActivityIndicatorView *activityIndicator;

@property (nonatomic, assign, readonly) BOOL isLoading;
- (void)startAnimating;
- (void)stopAnimating;

@end

@interface LoadBlankPageView : UIView
@property (nonatomic, strong) UIImageView   *blankPageImageView;
@property (nonatomic, strong) UILabel       *tipLabel;
@property (nonatomic, strong) UIButton      *reloadButton;
@property (nonatomic, copy) void(^reloadButtonBlock)(id sender);
- (void)configWithType:(LoadBlankPageType)blankPageType hasData:(BOOL)hasData hasError:(BOOL)hasError reloadButtonBlock:(void(^)(id sender))block;

@end
